<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2018/11/20
 * Time: 18:08
 */

namespace app\modules\dataMapper;

class User
{
    public $id;

    public $username;

    public $pass;

    /**
     * User constructor.
     * @param int $id
     * @param string $username
     * @param string $pass
     */
    public function __construct(int $id, string $username, string $pass)
    {
        $this->id = $id;
        $this->username = $username;
        $this->pass = $pass;
    }

    /**
     * @return int
     */
    public function getId(): int
    {
        return $this->id;
    }

    /**
     * @return string
     */
    public function getUsername(): string
    {
        return $this->username;
    }

    /**
     * @return string
     */
    public function getPass(): string
    {
        return $this->pass;
    }


    public static function fromState(array $state): User
    {
        return new self($state['id'], $state['username'], $state['pass']);
    }
}